package com.demo.androidgame.samgukji_hit;

import java.util.Timer;
import java.util.TimerTask;

import javax.microedition.khronos.opengles.GL10;

import com.demo.androidgame.fx.Game;
import com.demo.androidgame.fx.gl.Camera2D;
import com.demo.androidgame.fx.gl.SpriteBatcher;
import com.demo.androidgame.fx.impl.GLScreen;

public class LodingScreen extends GLScreen{

	Camera2D guiCam;
	SpriteBatcher batcher;
	
	public TimerTask mTask;
	public Timer timer;
	
	
	public LodingScreen(Game game) {
		super(game);
		
		guiCam = new Camera2D(glGraphics, 800, 480);
		batcher = new SpriteBatcher(glGraphics, 100);
		
		
	}

	@Override
	public void update(float deltaTime) {
		mTask = new TimerTask() {
			
			@Override
			public void run() {
				game.setScreen(new TitleScreen(game));
				
			}
		};
		timer = new Timer();
		timer.schedule(mTask, 3000);
		
		
	}

	@Override
	public void present(float deltaTime) {
		GL10 gl = glGraphics.getGL();        
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        guiCam.setViewportAndMatrices();
        
        gl.glEnable(GL10.GL_TEXTURE_2D);
        
        batcher.beginBatch(Assets.mark);
        batcher.drawSprite(400, 480 - 205, 250, 250, Assets.markRegion);
        batcher.endBatch();
        
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
        
        batcher.beginBatch(Assets.whathow);
        batcher.drawSprite(400, 80, 400, 120, Assets.markRegion);
        batcher.endBatch();
        
        gl.glDisable(GL10.GL_BLEND);
        gl.glDisable(GL10.GL_TEXTURE_2D);
        
		
	}

	@Override
	public void pause() {
		
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

}
